<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ASTS-客户工作台</title>
<script src="/customer_plat/public/javascripts/assets/js/jquery1.11.1.min.js"></script>
<script type="text/javascript" src="/customer_plat/public/javascripts/assets/chosen/amazeui.chosen.js"></script>
<script type="text/javascript" src="/customer_plat/public/javascripts/echarts-all.js?t=${System.currentTimeMillis()}"></script>

<link rel="stylesheet" href="/customer_plat/public/javascripts/assets/css/amazeui.min.css" />
 <link rel="stylesheet" href="/customer_plat/public/javascripts/assets/css/admin.css">
 <link rel="stylesheet" href="/customer_plat/public/javascripts/assets/chosen/amazeui.chosen.css" />
 
<!--[if lt IE 9]>
<script src="/customer_plat/public/javascripts/assets/js/jquery1.11.1.min.js"></script>
<script src="/customer_plat/public/javascripts/assets/js/modernizr.js"></script>
<script src="/customer_plat/public/javascripts/assets/js/polyfill/rem.min.js"></script>
<script src="/customer_plat/public/javascripts/assets/js/polyfill/respond.min.js"></script>
<script src="/customer_plat/public/javascripts/assets/js/amazeui.legacy.js"></script>
<![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<script src="/customer_plat/public/javascripts/stringBuffer.js"></script>
<script src="/customer_plat/public/javascripts/assets/js/amazeui.min.js"></script>
<script type="text/javascript" src="/customer_plat/public/javascripts/assets/chosen/amazeui.chosen.js"></script>
<!--<![endif]-->
<script src="/customer_plat/public/javascripts/assets/js/app.js"></script>
<script>
	function goUrl(url) {
		window.location.href = url;
	}
</script>
<!-- content start -->
<script>
	$(function() {
		$('.chosen-select-no-results').chosen({
			no_results_text : '木有找到匹配的项！'
		});
		$("#selProjectCost").change(function(){
			if($(this).val()!=""){
				 getCuttereByProjectId($(this).val(),"#cost_price");
			} 
		})
	})
	function getCuttereByProjectId(cutter_id,sel_id){
		 var params ={};
		 params.project_id = cutter_id;
 		 $.post("/customer_plat/home.homeaction/getProjectCutter",params,function(data){
 			 console.log(data);
			 $(sel_id).html("");
			 var cutters = data.data;
			 var str = "";
			 	var j = 1;
				for(var i =0;i<cutters.length;i++){
					if(cutters[i].status=="0"){
						str+="<span style='line-height:38px;width:500px;'>"+cutters[i].customer_specs_no+"/"+cutters[i].process_name+"/"+cutters[i].simple_specs_cust+"</span>";
						str+="&nbsp;&nbsp;&nbsp;单价：<input class='am-form-field' style='width: 150px;display: inline;' value='1' name = 'cost_material_id' cost_material_id='"+cutters[i].material_id+"' type='input' />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
					}else{
						str+="<span style='line-height:38px;width:500px;'>"+cutters[i].customer_specs_no+"/"+cutters[i].process_name+"/"+cutters[i].simple_specs_cust+"(已删)</span>";
							str+="&nbsp;&nbsp;&nbsp;单价：<input class='am-form-field' style='width: 150px;display: inline;' value='1' name = 'cost_material_id' cost_material_id='"+cutters[i].material_id+"' type='input' />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
					}
					if(j%2==0){
						str+="</br>";
					}
					j++;
				}
				$(sel_id).html(str);
			 
		 });
		
	}
 
</script>
<div class="admin-content">
	<div class="am-cf am-padding">
		<div class="am-fl am-cf">
			<strong class="am-text-primary am-text-lg">统计报表</strong> / <small>常用图表</small>
		</div>
	</div>
	<ul
		class="am-avg-sm-1 am-avg-md-4 am-margin am-padding am-text-center admin-content-list ">
		<li><a href="#" class="am-text-warning"><span
				class="am-icon-btn am-icon-briefcase"></span><br />今日领用<br />${useNum}</a></li>
		<li><a href="#" class="am-text-danger"><span
				class="am-icon-btn am-icon-user-md"></span><br />领刀人数<br />${useCount}</a></li>
		<li><a href="#" class="am-text-danger"><span
				class="am-icon-btn am-icon-recycle"></span><br />今日回收<br />${recNum}</a></li>
		<li><a href="#" class="am-text-danger"><span
				class="am-icon-btn am-icon-user-md"></span><br />回收人数<br />${recCount}</a></li> 
	</ul>

	<div class="am-g" style="float: left;">
		<div class="am-u-md-6">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd am-cf"
					data-am-collapse="{target: '#collapse-panel-1'}">
					项目使用刀具饼图<span class="am-icon-chevron-down am-fr"></span>&nbsp;&nbsp;&nbsp;
				<select id="selCustProject" class="chosen-select-no-results">
						<option value="-1">选择项目</option> ${projectsJSON} #{if projectsJSON!=null} 
						#{set count:1/} 
						#{list items:projectsJSON.data,as:'bean'}
						<option value="${bean?.project_id}">${bean?.project_name}</option>
						#{/list} #{/if}
				</select>
			 <input type="text" id="start_date"  class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="起始日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
			 <input type="text" id="end_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="结束日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
				<button type="button" id="projectSubmit" class="am-btn am-btn-primary btn-loading-example" style="height:38px;width: 80px;display: inline; padding-top: -10px;">查询</button>
				</div>
				<div style="height: 300px;" id="projectCutterSum"></div>
			</div>
		</div>
		<div class="am-u-md-6">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd am-cf"
					data-am-collapse="{target: '#collapse-panel-1'}">
					供应商消耗量<span class="am-icon-chevron-down am-fr"></span>&nbsp;&nbsp;&nbsp;
					 <input type="text" id="supplier_start_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="起始日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
			 <input type="text" id="supplier_end_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="结束日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
								<button type="button" id="supplier_btn" class="am-btn am-btn-primary btn-loading-example" style="height:38px;width: 80px;display: inline; padding-top: -10px;">查询</button>
				</div>
				<div style="height: 300px;" id="suppDiv"></div>
			</div>
		</div>
		</div>
			<div class="am-g"  style="float: left;">
		<div class="am-u-md-6">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd am-cf"
					data-am-collapse="{target: '#collapse-panel-1'}">
					领用刀具统计<span class="am-icon-chevron-down am-fr"></span>&nbsp;&nbsp;&nbsp;
					<select id="selUseRecord" class="chosen-select-no-results">
						<option value="-1">物料编码/物料全称/供应商</option> #{if custCutterSupps!=null}
						#{set count:1/} #{list items:custCutterSupps.data,as:'bean'}
						<option value="${bean?.material_id}">${bean?.customer_specs_no}/${bean?.cutter_specs}&nbsp;|&nbsp;${bean?.supp_name}</option>
						#{/list} #{/if}
					</select>
					 <input type="text" id="use_start_date"  class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="起始日期" data-am-datepicker readonly required />
			 <input type="text" id="use_end_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="结束日期" data-am-datepicker readonly required />
				<button type="button" id="use_btn" class="am-btn am-btn-primary btn-loading-example" style="height:38px;width: 80px;display: inline; padding-top: -10px;">查询</button>
				</div>
								<span id="useRecordError" ></span>
				<div style="height: 300px;" id="useRecord"></div>
			</div>
		</div>
		<div class="am-u-md-6">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd am-cf"
					data-am-collapse="{target: '#collapse-panel-1'}">
	 				回收刀具统计<span class="am-icon-chevron-down am-fr"></span>&nbsp;&nbsp;&nbsp;
					<select id="selRecRecord" class="chosen-select-no-results">
						<option value="-1">物料编码/物料全称/供应商</option> #{if custCutterSupps!=null}
						#{set count:1/} #{list items:custCutterSupps.data,as:'bean'}
						<option value="${bean?.material_id}">${bean?.customer_specs_no}/${bean?.cutter_specs}/${bean?.supp_name}</option>
						#{/list} #{/if}
					</select>
					
					 <input type="text" id="rec_start_date"  class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="起始日期" data-am-datepicker readonly required />
			 <input type="text" id="rec_end_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="结束日期" data-am-datepicker readonly required />
				<button type="button" id="rec_btn" class="am-btn am-btn-primary btn-loading-example" style="height:38px;width: 80px;display: inline; padding-top: -10px;">查询</button>
				</div>
												<span id="recRecordError"></span>
				<div style="height: 300px;" id="recRecord"></div>
			</div>
		</div>
	</div>
		<div class="am-g" style="float: left;">
				<div class="am-u-md-12">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd am-cf"
					data-am-collapse="{target: '#collapse-panel-1'}">
					查询工序用量图表<span class="am-icon-chevron-down am-fr"></span>&nbsp;&nbsp;&nbsp;
				<select id="selCustProject2" class="chosen-select-no-results" >
						<option value="-1">选择项目</option> ${projectsJSON} #{if projectsJSON!=null} 
						#{set count:1/} 
						#{list items:projectsJSON.data,as:'bean'}
						<option value="${bean?.project_id}">${bean?.project_name}</option>
						#{/list} #{/if}
				</select>
				<select id="selCustProcess"  >
				<option>请先选择项目</option>
				</select>
				<select id="selType" >
								<option value="1">人员</option>
								<option value="2">刀具</option>
								<option value="3">群组</option>
				</select>
			 <input type="text" id="process_start_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="起始日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
			 <input type="text" id="process_end_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="结束日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
				<button type="button" id="processDetailsSubmit" class="am-btn am-btn-primary btn-loading-example" style="height:38px;width: 80px;display: inline; padding-top: -10px;">查询</button>
				</div>
								<span id="processDetailsCutterError"></span>
				<div style="height: 300px;" id="processDetailsCutterSum"></div>
			</div>
		</div>
		</div>
	<div class="am-g" style="float: left;">
		<div class="am-u-md-6">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd am-cf"
					data-am-collapse="{target: '#collapse-panel-1'}">
					项目用刀量总量图表<span class="am-icon-chevron-down am-fr"></span>&nbsp;&nbsp;&nbsp;
				<select id="selCustProjectDetails" class="chosen-select-no-results">
						<option value="-1">选择项目</option> ${projectsJSON} #{if projectsJSON!=null} 
						#{set count:1/} 
						#{list items:projectsJSON.data,as:'bean'}
						<option value="${bean?.project_id}">${bean?.project_name}</option>
						#{/list} #{/if}
				</select>
			 <input type="text" id="details_start_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="起始日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
			 <input type="text" id="details_end_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="结束日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
				<button type="button" id="projectDetailsSubmit" class="am-btn am-btn-primary btn-loading-example" style="height:38px;width: 80px;display: inline; padding-top: -10px;">查询</button>
				</div>
				<span id="projectDetailsCutterError"></span>
				<div style="height: 300px;" id="projectDetailsCutterSum"></div>
			</div>
		</div>
	 <div class="am-u-md-6">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd am-cf"
					data-am-collapse="{target: '#collapse-panel-1'}">
					计划产能统计图表<span class="am-icon-chevron-down am-fr"></span>&nbsp;&nbsp;&nbsp;
				<select id="selPlanYield" class="chosen-select-no-results">
						<option value="-1">选择计划</option> ${plansJSON} #{if plansJSON!=null} 
						#{set count:1/} 
						#{list items:plansJSON.data,as:'bean'}
						<option value="${bean?.plan_id}">${bean?.plan_name}</option>
						#{/list} #{/if}
				</select>
			 <input type="text" id="plan_start_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="起始日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
			 <input type="text" id="plan_end_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="结束日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
				<button type="button" id="planYieldSubmit" class="am-btn am-btn-primary btn-loading-example" style="height:38px;width: 80px;display: inline; padding-top: -10px;">查询</button>
				</div>
				<span id="planYieldError" ></span>
				<div style="height: 300px;" id="planYieldDiv">
				</div>
			</div>
		</div>
		 <div class="am-u-md-12">
			<div class="am-panel am-panel-default">
				<div class="am-panel-hd am-cf"
					data-am-collapse="{target: '#collapse-panel-1'}">
					 项目成本统计图表<span class="am-icon-chevron-down am-fr"></span>&nbsp;&nbsp;&nbsp;
				<select id="selProjectCost" class="chosen-select-no-results">
						<option value="-1">选择项目</option> ${projectsJSON} #{if projectsJSON!=null} 
						#{set count:1/} 
						#{list items:projectsJSON.data,as:'bean'}
						<option value="${bean?.project_id}">${bean?.project_name}</option>
						#{/list} #{/if}
				</select>
				<input type="text" id="cost_start_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="起始日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
			 <input type="text" id="cost_end_date" class="am-form-field" style="height:36px;width: 150px;display: inline;" placeholder="结束日期" data-am-datepicker readonly required />
				&nbsp;&nbsp;
				<button type="button" id="costSubmit"  class="am-btn am-btn-primary btn-loading-example" style="height:38px;width: 80px;display: inline; padding-top: -10px;">查询</button>
				<div id="cost_price">
				</div>
			  
				</div>
				<span id="costError"></span>
				<div style="height: 300px;" id="costDiv">
				</div>
			</div>
		</div>
		
		
	</div>
</div>
</div>
<!-- content end -->
<script>
	$(function() {
		suppConsumeSum($("#supplier_start_date").val(),$("#supplier_end_date").val());
	//	getCutterAvgLife();
	//	getCutterConsumeList("-1");
	//	getCutterInventoryList("-1");
	//	getOperatorComsume("-1");
		$("#supplier_btn").click(function() {
			suppConsumeSum($("#supplier_start_date").val(),$("#supplier_end_date").val());
		})
		$("#selCustCutters").change(function() {
			getCutterConsumeList($(this).val());
		})
		$("#selCutterInventory").change(function() {
			getCutterInventoryList($(this).val());
		})
		$("#selOperatorComsume").change(function() {
			getOperatorComsume($(this).val());
		})
		$("#selUseRecord").change(function() {
			getUseRecord($(this).val(),$("#use_start_date").val(),$("#use_end_date").val());
		})
		$("#selRecRecord").change(function() {
			getRecRecord($(this).val(),$("#rec_start_date").val(),$("#rec_end_date").val());
		})
		$("#use_btn").click(function(){
			getUseRecord($("#selUseRecord").val(),$("#use_start_date").val(),$("#use_end_date").val());
		})
		$("#rec_btn").click(function(){
			getRecRecord($("#selRecRecord").val(),$("#rec_start_date").val(),$("#rec_end_date").val());
		})
		$("#selCustProject2").change(function(){
				var project_id  = $(this).val();
				$.post("/customer_plat/project.ProjectManageAction/getProcessByProjectId","project_id="+project_id,function(data){
					var processArr = data.data;
					var str = "";
					for(var i =0;i<processArr.length;i++){
						str+="<option value='"+processArr[i].process_id+"'>"+processArr[i].process_name+"</option>";	
						console.log(str);
					}
					$("#selCustProcess").html(str);
				});
		})
		$("#costSubmit").click(function(){
			var priceJSON  = {};
			var params = {};
			var boo = true ;
			$("input[name='cost_material_id']").each(function(j,item){
				if($(this).val()==""){
					alert("单价不能为空,若不查该物料请填写 0");
					boo = false;
				}
				priceJSON[$(this).attr("cost_material_id")]=$(this).val(); 
			});
			if($("#selProjectCost").val()==""){
				alert("项目不能为空")
				return false;
			}
			if($("#cost_start_date").val()==""){
				alert("起始日期不能为空")
				return false;
			}
			if($("#cost_end_date").val()==""){
				alert("结束日期不能为空")
				return false;
			}
			var projectCost = [{"value":"123"}]
			if(boo!=false){
				params.project_id = $("#selProjectCost").val();
				params.start_date = $("#cost_start_date").val();
				params.end_date = $("#cost_end_date").val();
				params.priceJSON = JSON.stringify(priceJSON);
				$.ajax({
					type : "post",
					data : params,
					url : "getProjectCutterCostRecord",
					async : false,
					success : function(data) {
						projectCost = data;
					}
				});
				var cutterAvgLife = document.getElementById('costDiv');
				var myChart = echarts.init(cutterAvgLife);
				if(projectCost.series==""){
					$("#costError").html("暂无数据");
				}else{
					$("#costError").html("");
				}
				var option = {
					tooltip : {
						trigger : 'axis'
					},
					legend : {
						data : projectCost.legendList
					},
					toolbox : {
						show : true,
						feature : {
							mark : {
								show : true
							},
							dataView : {
								show : true,
								readOnly : false
							},
							magicType : {
								show : true,
								type : [ 'line', 'bar' ]
							},
							restore : {
								show : true
							},
							saveAsImage : {
								show : true
							}
						}
					},
					calculable : true,
					xAxis : [ {
						type : 'category',
						data : projectCost.xAxisList
					} ],
					yAxis : [ {
						type : 'value'
					} ],
					series : projectCost.series
				};
				myChart.setOption(option);
			}
		});
		var projectCutter =[{"value" : "123"}];
		$("#projectSubmit").click(function(){
			var params = {};
			var project =  $("#selCustProject").val();
			var start = $("#start_date").val();
			var end = $("#end_date").val();
			if(project=="-1"){
				alert("请选择项目");
				return false;
			}
			if(project==""){
				alert("请选择项目");
				return false;
			}
			if(start==""){
				alert("请输入起始日期");
				return false;
			}
			params.project_id = project;
			params.start_date=start;
			params.end_date=end;
			$.ajax({
				type : "post",
				data : params,
				url : "getProjectByPeriodQuerySum",
				async : false,
				success : function(data) {
					projectCutter = data;
				}
			});
			var projectCutterSum = document.getElementById('projectCutterSum');
			var myChart = echarts.init(projectCutterSum);
			var option = {
				tooltip : {
					trigger : 'item',
					formatter : "{a} <br/>{b} : {c} ({d}%)"
				},
				legend : {
					orient : 'vertical',
					x : 'left',
					data :projectCutter
				},
				toolbox : {
					show : true,
					feature : {
						dataView : {
							show : true,
							readOnly : false
						},
						magicType : {
							show : true,
							type : [ 'pie', 'funnel' ],
							option : {
								funnel : {
									x : '25%',
									width : '50%',
									funnelAlign : 'left',
									max : 1548
								}
							}
						},
						restore : {
							show : true
						},
						saveAsImage : {
							show : true
						}
					}
				},
				calculable : true,
				series : [ {
					name : '项目刀具使用总数',
					type : 'pie',
					radius : '55%',
					center : [ '50%', '60%' ],
					data : projectCutter
				} ]
			};
			// 为echarts对象加载数据 
			myChart.setOption(option);
			
		});
		var projectDetails =[{"value" : "123"}];
		$("#projectDetailsSubmit").click(function(){
			var params = {};
			var project =  $("#selCustProjectDetails").val();
			var start = $("#details_start_date").val();
			var end = $("#details_end_date").val();
			if(project=="-1"){
				alert("请选择项目");
				return false;
			}
			if(project==""){
				alert("请选择项目");
				return false;
			}
			if(start==""){
				alert("请输入起始日期");
				return false;
			}
			params.project_id = project;
			params.start_date=start;
			params.end_date=end;
			$.ajax({
				type : "post",
				data : params,
				url : "/customer_plat/home.homeaction/projectRealUseStatistics",
				async : false,
				success : function(data) {
					projectDetails = data;
				}
			});
			var cutterAvgLife = document.getElementById('projectDetailsCutterSum');
			var myChart = echarts.init(cutterAvgLife);
			if(projectDetails.series==""){
				$("#projectDetailsCutterError").html("暂无数据");
			}else{
				$("#projectDetailsCutterError").html("");
			}
			var option = {
				tooltip : {
					trigger : 'axis'
				},
				legend : {
					data : projectDetails.legendList
				},
				toolbox : {
					show : true,
					feature : {
						mark : {
							show : true
						},
						dataView : {
							show : true,
							readOnly : false
						},
						magicType : {
							show : true,
							type : [ 'line', 'bar' ]
						},
						restore : {
							show : true
						},
						saveAsImage : {
							show : true
						}
					}
				},
				calculable : true,
				xAxis : [ {
					type : 'category',
					data : projectDetails.xAxisList
				} ],
				yAxis : [ {
					type : 'value'
				} ],
				series : projectDetails.series
			};
			myChart.setOption(option);
		});
		var processDetails =[{"value" : "123"}];
		$("#processDetailsSubmit").click(function(){
			var params = {};
			var project =  $("#selCustProject2").val();
			var process = $("#selCustProcess").val();
			var type = $("#selType").val();
			var start = $("#process_start_date").val();
			var end = $("#process_end_date").val();
			if(project=="-1"){
				alert("请选择项目");
				return false;
			}
			if(project==""){
				alert("请选择项目");
				return false;
			}
			if(process==""){
				alert("请选择工序");
				return false;
			}
			if(type==""){
				alert("请选择类型");
				return false;
			}
			if(start==""){
				alert("请输入起始日期");
				return false;
			}
			params.process_id = process;
			params.type = type;
			params.start_date=start;
			params.end_date=end;
			$.ajax({
				type : "post",
				data : params,
				url : "/customer_plat/home.homeaction/processStatistics",
				async : false,
				success : function(data) {
					processDetails = data;
				}
			});
			var cutterAvgLife = document.getElementById('processDetailsCutterSum');
			var myChart = echarts.init(cutterAvgLife);
			if(processDetails.series==""){
				$("#processDetailsCutterError").html("暂无数据");
			}else{
				$("#processDetailsCutterError").html("");
			}
			var option = {
				tooltip : {
					trigger : 'axis'
				},
				legend : {
					data : processDetails.legendList
				},
				toolbox : {
					show : true,
					feature : {
						mark : {
							show : true
						},
						dataView : {
							show : true,
							readOnly : false
						},
						magicType : {
							show : true,
							type : [ 'line', 'bar' ]
						},
						restore : {
							show : true
						},
						saveAsImage : {
							show : true
						}
					}
				},
				calculable : true,
				xAxis : [ {
					type : 'category',
					data : processDetails.xAxisList
				} ],
				yAxis : [ {
					type : 'value'
				} ],
				series : processDetails.series
			};
			myChart.setOption(option);
		});
		var planYield =[{"value" : "123"}];
		$("#planYieldSubmit").click(function(){
			var params = {};
			var plan = $("#selPlanYield").val();
			var start = $("#plan_start_date").val();
			var end = $("#plan_end_date").val();
			if(plan=="-1"){
				alert("请选择生产计划");
				return false;
			}
			if(plan==""){
				alert("请选择生产计划");
				return false;
			}
			if(start==""){
				alert("请输入起始日期");
				return false;
			}
			params.plan_id = plan;
			params.start_date=start;
			params.end_date=end;
			$.ajax({
				type : "post",
				data : params,
				url : "/customer_plat/home.homeaction/productionPlanYield",
				async : false,
				success : function(data) {
					planYield = data;
				}
			});
			var cutterAvgLife = document.getElementById('planYieldDiv');
			var myChart = echarts.init(cutterAvgLife);
			if(planYield.series==""){
				$("#planYieldError").html("暂无数据");
			}else{
				$("#planYieldError").html("");
			}
			var option = {
				tooltip : {
					trigger : 'axis'
				},
				legend : {
					data : planYield.legendList
				},
				toolbox : {
					show : true,
					feature : {
						mark : {
							show : true
						},
						dataView : {
							show : true,
							readOnly : false
						},
						magicType : {
							show : true,
							type : [ 'line', 'bar' ]
						},
						restore : {
							show : true
						},
						saveAsImage : {
							show : true
						}
					}
				},
				calculable : true,
				xAxis : [ {
					type : 'category',
					data : planYield.xAxisList
				} ],
				yAxis : [ {
					type : 'value'
				} ],
				series : planYield.series
			};
			myChart.setOption(option);
		});
		
	})
	var consume = [ {
		"value" : "123"
	} ];
	// 基于准备好的dom，初始化echarts图表
	function suppConsumeSum(start_date,end_date) {
		var params = {};
		params.start_date = start_date;
		params.end_date = end_date;
		$.ajax({
			type : "post",
			data : params,
			url : "/customer_plat/home.homeaction/getSuppConsumeSum",
			async : false,
			success : function(data) {
				consume = data;
			}
		});
		var suppDiv = document.getElementById('suppDiv');
		var myChart = echarts.init(suppDiv);
		var option = {
			tooltip : {
				trigger : 'item',
				formatter : "{a} <br/>{b} : {c} ({d}%)"
			},
			legend : {
				orient : 'vertical',
				x : 'left',

				data : consume.data
			},
			toolbox : {
				show : true,
				feature : {
					dataView : {
						show : true,
						readOnly : false
					},
					magicType : {
						show : true,
						type : [ 'pie', 'funnel' ],
						option : {
							funnel : {
								x : '25%',
								width : '50%',
								funnelAlign : 'left',
								max : 1548
							}
						}
					},
					restore : {
						show : true
					},
					saveAsImage : {
						show : true
					}
				}
			},
			calculable : true,
			series : [ {
				name : '供应商刀具消耗量',
				type : 'pie',
				radius : '55%',
				center : [ '50%', '60%' ],
				data : consume.data
			} ]
		};
		// 为echarts对象加载数据 
		myChart.setOption(option);
	}
	var cutterAvg = [ {
		"value" : "123"
	} ];
	function getCutterAvgLife() {
		$.ajax({
			type : "post",
			url : "/customer_plat/home.homeaction/getCutterAvgLife",
			async : false,
			success : function(data) {
				cutterAvg = data;
			}
		});
		var cutterAvgLife = document.getElementById('cutterAvgLife');
		var myChart = echarts.init(cutterAvgLife);
		var option = {
			title : {
				text : '本年度某刀具平均寿命',
			},
			tooltip : {
				trigger : 'axis'
			},
			legend : {
				data : cutterAvg.legendList
			},
			toolbox : {
				show : true,
				feature : {
					mark : {
						show : true
					},
					dataView : {
						show : true,
						readOnly : false
					},
					magicType : {
						show : true,
						type : [ 'line', 'bar' ]
					},
					restore : {
						show : true
					},
					saveAsImage : {
						show : true
					}
				}
			},
			calculable : true,
			xAxis : [ {
				type : 'category',
				data : cutterAvg.xAxisList
			} ],
			yAxis : [ {
				type : 'value'
			} ],
			series : cutterAvg.series
		};
		myChart.setOption(option);
	}
	var cutterConsume = [ {
		"value" : "123"
	} ];
	//消耗量
	function getCutterConsumeList(cutter_specs) {
		$.ajax({
			type : "post",
			url : "/customer_plat/home.homeaction/getCutterConsumeList",
			data : "cutter_specs=" + cutter_specs,
			async : false,
			success : function(data) {
				cutterConsume = data;
			}
		});
		var cutterConsumeDiv = document.getElementById('cutterConsume');
		var myChart = echarts.init(cutterConsumeDiv);
		var option = {
			title : {
				text : '本年度刀具消耗报表',
			},
			tooltip : {
				trigger : 'axis'
			},
			legend : {
				data : cutterConsume.legendList
			},
			toolbox : {
				show : true,
				feature : {
					mark : {
						show : true
					},
					dataView : {
						show : true,
						readOnly : false
					},
					magicType : {
						show : true,
						type : [ 'line', 'bar' ]
					},
					restore : {
						show : true
					},
					saveAsImage : {
						show : true
					}
				}
			},
			calculable : true,
			xAxis : [ {
				type : 'category',
				data : cutterConsume.xAxisList
			} ],
			yAxis : [ {
				type : 'value'
			} ],
			series : cutterConsume.series
		};
		myChart.setOption(option);
	}
	var cutterInventory = [ {
		"value" : "123"
	} ];
	//刀具库存
	function getCutterInventoryList(cutter_specs) {
		$.ajax({
			type : "post",
			url : "/customer_plat/home.homeaction/getCutterInventoryList",
			data : "cutter_specs=" + cutter_specs,
			async : false,
			success : function(data) {
				cutterInventory = data;
			}
		});
		var cutterInventoryDiv = document.getElementById('cutterInventory');
		var myChart = echarts.init(cutterInventoryDiv);
		var option = {
			title : {
				text : '本年度刀具使用库存',
			},
			tooltip : {
				trigger : 'axis'
			},
			legend : {
				data : cutterInventory.legendList
			},
			toolbox : {
				show : true,
				feature : {
					mark : {
						show : true
					},
					dataView : {
						show : true,
						readOnly : false
					},
					magicType : {
						show : true,
						type : [ 'line', 'bar' ]
					},
					restore : {
						show : true
					},
					saveAsImage : {
						show : true
					}
				}
			},
			calculable : true,
			xAxis : [ {
				type : 'category',
				data : cutterInventory.xAxisList
			} ],
			yAxis : [ {
				type : 'value'
			} ],
			series : cutterInventory.series
		};
		myChart.setOption(option);
	}
	var operatorComsume = [ {
		"value" : "123"
	} ];
	//刀具库存
	function getOperatorComsume(material_id) {
		$.ajax({
			type : "post",
			url : "/customer_plat/home.homeaction/getOperatorComsumeList",
			data : "material_id=" + material_id,
			async : false,
			success : function(data) {
				operatorComsume = data;
			}
		});
		var operatorComsumeDiv = document.getElementById('operatorComsume');
		var myChart = echarts.init(operatorComsumeDiv);
		var option = {
			title : {
				text : '本年度操作员平均消耗量',
			},
			tooltip : {
				trigger : 'axis'
			},
			legend : {
				data : operatorComsume.legendList
			},
			toolbox : {
				show : true,
				feature : {
					mark : {
						show : true
					},
					dataView : {
						show : true,
						readOnly : false
					},
					magicType : {
						show : true,
						type : [ 'line', 'bar' ]
					},
					restore : {
						show : true
					},
					saveAsImage : {
						show : true
					}
				}
			},
			calculable : true,
			xAxis : [ {
				type : 'category',
				data : operatorComsume.xAxisList
			} ],
			yAxis : [ {
				type : 'value'
			} ],
			series : operatorComsume.series
		};
		myChart.setOption(option);
	}
	var useRecord = [ {
		"value" : "123"
	} ];
	function getUseRecord(material_id,start_date,end_date) {
		var params = {};
		params.material_id = material_id;
		params.start_date = start_date;
		params.end_date = end_date;

		$.ajax({
			type : "post",
			url : "/customer_plat/home.homeaction/useRecordMonthStatistics",
			data : params,
			async : false,
			success : function(data) {
				useRecord = data;
			}
		});
		var useRecordDiv = document.getElementById('useRecord');
		var myChart = echarts.init(useRecordDiv);
		if(useRecord.series==""){
			$("#useRecordError").html("暂无数据");
		}else{
			$("#useRecordError").html("");
		}
		var option = {
			title : {
				text : '本年度领用记录统计',
			},
			tooltip : {
				trigger : 'axis'
			},
			legend : {
				data : useRecord.legendList
			},
			toolbox : {
				show : true,
				feature : {
					mark : {
						show : true
					},
					dataView : {
						show : true,
						readOnly : false
					},
					magicType : {
						show : true,
						type : [ 'line', 'bar' ]
					},
					restore : {
						show : true
					},
					saveAsImage : {
						show : true
					}
				}
			},
			calculable : true,
			xAxis : [ {
				type : 'category',
				data : useRecord.xAxisList
			} ],
			yAxis : [ {
				type : 'value'
			} ],
			series : useRecord.series
		};
		myChart.setOption(option);
	}

	var recRecord = [ {
		"value" : "123"
	} ];
	function getRecRecord(material_id,start_date,end_date) {
		var params = {};
		params.material_id = material_id;
		params.start_date = start_date;
		params.end_date = end_date;
		$.ajax({
			type : "post",
			url : "/customer_plat/home.homeaction/recoveRecordMonthStatistics",
			data : params,
			async : false,
			success : function(data) {
				recRecord = data;
			}
		});
		var recRecordDiv = document.getElementById('recRecord');
		var myChart = echarts.init(recRecordDiv);
		if(recRecord.series==""){
			$("#recRecordError").html("暂无数据");
		}else{
			$("#recRecordError").html("");
		}
		var option = {
			title : {
				text : '本年度回收记录统计',
			},
			tooltip : {
				trigger : 'axis'
			},
			legend : {
				data : recRecord.legendList
			},
			toolbox : {
				show : true,
				feature : {
					mark : {
						show : true
					},
					dataView : {
						show : true,
						readOnly : false
					},
					magicType : {
						show : true,
						type : [ 'line', 'bar' ]
					},
					restore : {
						show : true
					},
					saveAsImage : {
						show : true
					}
				}
			},
			calculable : true,
			xAxis : [ {
				type : 'category',
				data : recRecord.xAxisList
			} ],
			yAxis : [ {
				type : 'value'
			} ],
			series : recRecord.series
		};
		myChart.setOption(option);
	}
	function projectCost(){
		
	}
</script>